package com.esms.utils.convert;

import ma.glasnost.orika.MappingContext;
import ma.glasnost.orika.converter.BidirectionalConverter;
import ma.glasnost.orika.metadata.Type;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

public class Time2StringConverter extends BidirectionalConverter<Timestamp,String> {


   @Override
   public String convertTo(Timestamp timestamp, Type<String> type, MappingContext mappingContext) {
      SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      return sdf.format(timestamp);
   }

   @Override
   public Timestamp convertFrom(String s, Type<Timestamp> type, MappingContext mappingContext) {
      return null;
   }
}